package com.atguigu.gmall.order.client.impl;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author Fxz
 * @version 1.0
 * @date 2022-02-19 19:48
 */
@Slf4j
@Component
public class OrderDegradeFeignClient implements FallbackFactory<OrderFeignClient> {

	@Override
	public OrderFeignClient create(Throwable throwable) {
		log.error(throwable.getMessage());
		return new OrderFeignClient() {
			@Override
			public Result trade() {
				return null;
			}

			@Override
			public OrderInfo getOrderInfo(Long orderId) {
				return null;
			}

			@Override
			public Long submitOrder(OrderInfo orderInfo) {
				return null;
			}
		};
	}

}
